<?php
/**
 * 
 * @author chenlisong
 *
 */
class IndexAction extends BaseAction{ 
	Public function index(){
		$this->display();
	}
	
	// 修改密码
	public function editPwd(){
		$Model = M('AdminUser');
		$where['id'] = $_REQUEST['id'];
		$vo = $Model->where($where)->find();
		$this->assign('vo',$vo);
		$this->display();
	}
	
	//更新密码
	public function update() {
		$Model = M('AdminUser');
		$where['id'] = $_REQUEST['id'];
		$data['password'] = $_REQUEST['password'];
		$vo = $Model->where($where)->find();
		if($_REQUEST['oldpassword'] != $vo['password']) {
			$this->ajaxReturn(0,"旧密码错误，请检查后重新提交",0);
		}
		// 更新数据
		if(false !== $Model->where($where)->save($data)) {
			$this->ajaxReturn(1,L('ADMIN_EDIT_SUCCESS'),1);
		} else {
			$this->ajaxReturn(0,L('ADMIN_EDIT_ERROR'),0);
		}
	}
	
	Public function main(){
		$this->display();
	}
	
}
